<template>
	<view class="pages-index">
		<!-- <view class="top-box">
			<view :class=" tabNum? 'top-item-yes' : 'top-item-no' " @click="tabBnt()">
				景区介绍
			</view>
			<view :class=" !tabNum? 'top-item-yes' : 'top-item-no' " @click="tabBnt()">
				导游订购
			</view>
		</view> -->
		<view class="jqjsList-box" v-if="tabNum">
			<view class="jqjs-item" v-for="(item,index) in jqjsList" :key="index" @click="jqjsBnt(item)">
				<image :src="baseOssUrl2 + item.phone" class="jqjs-img" mode="aspectFill"></image>
				<view class="jqjs-info">
					<view class="jqjs-title">
						{{item.jj||''}}
					</view>
					<view class="jqjs-tag">
						<view class="jqjs-itemtag">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="dydg-box" v-if="!tabNum">
		<!-- 	<view class="tiem-box">
				这是时间选择的地方
			</view> -->
			<view class="dydg-title">
				本日全部导游
			</view>
			<view class="dyList-box" >
				<view class="dydg-item" v-for="(item,index) in dyList" :key="index">
					<view class="dydg-top">
						<image :src="baseOssUrl2 + item.dyPhoto" class="dydg-img" mode=""></image>
						<view class="dydg-info">
							<view class="dydg-info-top">
								<view class="dydg-name">
									{{item.dyName}}
								</view>
								<view class="dydg-type">
									高级导游
								</view>
							</view>
							<view class="dydg-info-bottom">
								{{item.dyJj}}
							</view>
						</view>
					</view>
					<view class="dydg-bottm">
						<view class="dydg-bottm-tag">
							微山湖风景旅游
						</view>
						<view class="dydg-bottm-status">
							空闲
						</view>
						<view class="dydg-bottm-bnt" @click="severBnt(item)">
							订购
						</view>
					</view>
				</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	import {
		baseOssUrl,
		baseOssUrl2
	} from '@/common/settings';
	export default {
		data() {
			return {
				baseOssUrl: baseOssUrl,
				baseOssUrl2:baseOssUrl2,
				tabNum: true,
				jqjsList:[], //景区介绍列表
				dyList:[], // 导游订购列表
				page:1,
				limit:10,
				total:''
			}
		},
		onLoad(e) {
			this.getJqList()
		},
		methods: {
			// 获取景区列表
			getJqList() {
				this.$http.get(this.$httpApi.ywglList, {
					data: {
						page:this.page,
						limit:this.limit,
					}
				}).then(res => {
					if (res.code == 0) {
						if (res.pages == 1) {
							this.jqjsList = res.page
						} else if (res.pages == 0) {
							this.jqjsList = []
						} else {
							this.jqjsList = this.jqjsList.concat(res.page)
						}
						console.log("list", this.jqjsList)
						this.total = res.total
					}
				})
			},
			// 获取导游列表
			getdyList() {
				this.$http.get(this.$httpApi.dybList, {
					data: {
						page:this.page,
						limit:this.limit,
					}
				}).then(res => {
					if (res.code == 0) {
						if (res.pages == 1) {
							this.dyList = res.page
						} else if (res.pages == 0) {
							this.dyList = []
						} else {
							this.dyList = this.dyList.concat(res.page)
						}
						console.log("list", this.dyList)
						this.total = res.total
					}
				})
			},
			// 导游下单
			severBnt(item) {
				uni.navigateTo({
					url:'/pages/scenic/buy/index?id=' + item.id
				})
			},
			// 导航栏切换
			tabBnt() {
				this.tabNum = !this.tabNum
				if(this.tabNum) {
					this.page = 1
					this.limit = 10
					this.getJqList()
				} else {
					this.page = 1
					this.limit = 10
					this.getdyList()
				}
			},
			// 景区介绍跳转详情
			jqjsBnt(e) {
				uni.navigateTo({
					url:'/pages/trip/details/index?id=' + e.id
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.pages-index {
		.top-box {
			position: sticky;
			top: 0rpx;
			display: flex;
			align-items: center;
			height: 100rpx;
			background-color: #ffffff;
			.top-item-yes {
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #0CA8EE;
			}
			.top-item-no {
				flex: 1;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 28rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #2A2A2A;
			}
		}
		.jqjsList-box {
			padding: 26rpx;
			.jqjs-item {
				background: #FFFFFF;
				box-shadow: -4rpx 4rpx 29rpx 0rpx rgba(134,134,134,0.18);
				border-radius: 10rpx;
				margin-bottom: 23rpx;
				overflow: hidden;
				.jqjs-img {
					width: 100%;
					height: 280rpx;
				}
				.jqjs-info {
					padding: 43rpx 22rpx 33rpx 22rpx;
					.jqjs-title {
						font-size: 30rpx;
						color: #303030;
					}
					.jqjs-tag {
						margin-top: 32rpx;
						display: flex;
						align-items: center;
						.jqjs-itemtag {
							padding: 7rpx 14rpx 7rpx 14rpx;
							background: #FDD825;
							border-radius: 7rpx;
							display: flex;
							align-items: center;
							font-size: 21rpx;
							color: #303030;
						}
					}
				}
			}
		}
		.dydg-box {
			.dydg-title {
				padding: 30rpx 24rpx 30rpx 24rpx;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: bold;
				color: #1C1D22;
			}
			.dyList-box {
				padding-left: 26rpx;
				padding-right: 26rpx;
				.dydg-item {
					background-color: #ffffff;
					border-radius: 10rpx;
					padding: 26rpx;
					margin-bottom: 24rpx;
					.dydg-top {
						display: flex;
						align-items: center;
						.dydg-img {
							width: 106rpx;
							height: 140rpx;
							border-radius: 7rpx;
						}
						.dydg-info {
							margin-left: 35rpx;
							.dydg-info-top {
								display: flex;
								.dydg-name {
									font-size: 30rpx;
									font-weight: bold;
								}
								.dydg-type {
									margin-left: 30rpx;
									font-size: 24rpx;
									color: #6A6A6A;
								}
							}
							.dydg-info-bottom {
								font-size: 22rpx;
								font-weight: 500;
								color: #A5A5A5;
							}
						}
					}
					.dydg-bottm {
						display: flex;
						align-items: center;
						.dydg-bottm-tag {
							padding: 9rpx;
							font-size: 23rpx;
							font-weight: 500;
							color: #DF8620;
							background-color: #FEF4EB;
							border-radius: 7rpx;
						}
						.dydg-bottm-status {
							flex: 1;
							text-align: center;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #323030;
						}
						.dydg-bottm-bnt {
							margin-left: auto;
							width: 121rpx;
							height: 64rpx;
							background: #B9B9B9;
							border-radius: 32rpx;
							font-size: 26rpx;
							font-family: PingFang SC;
							font-weight: 500;
							color: #FFFFFF;
							display: flex;
							align-items: center;
							justify-content: center;
						}
					}
				}
			}
		}
	}
</style>
